<?php

class Gallery_Block_Categories_Backend extends Kernel_Block 
{
    
    /**
     * Return template data. 
     *
     * @return  array
     */
    public function getData() 
    {
        $entries = Gallery_Backend_Utils::getCategories();
        
        // copy-pasta, copy-pasta, copy-pasta :)
        // :KLUDGE: 20081006 dV: as menu is got from cach we force to walk through
        // array manually to set active resource
        foreach ($entries as &$entry) {
            $entry['active'] = $entry['id'] == Gallery_Backend_Utils::activeFilter();
            $entry['backend_url'] = array(Gallery_Backend_Utils::FILTER => $entry['id']);
        }
        
        return array(
            'entries' => Kernel_Util_Tree::convert($entries), 
            'current' => Gallery_Backend_Utils::activeFilter(), 
            );
    }
    
}